package com.subfg.payment.constant;

public enum UriDesciptionEnum {
    INIT_URIDESCIPTION("未知的, 初始化未获取的", "unkown"),
    API_PAYMENT_BUYINFO("生成三方支付信息", "/payment/createPayInfo"),
    API_PAYMENT_REFUND("执行三方退款",  "/payment/moreRefund"),
    API_PAYMENT_ISPAYMENT("查询订单是否支付", "/payment/checkoutOrderBilling")
    ;

    private String message;
    private String apiName;


    public String getApiName(){
        return this.apiName;
    }
    public String getMessage(){
        return this.message;
    }

    UriDesciptionEnum(String message, String apiName) {
        this.message = message;
        this.apiName = apiName;
    }

    /**
     * 请求时的uri信息 是否存在本系统
     * @param uri   请求时的uri
     * @return
     */
    public static UriDesciptionEnum fromCode(String uri) {
        if(uri != null){
            for(UriDesciptionEnum uriDesciptionEnum : values()){
                if(uri.equals(uriDesciptionEnum.getApiName())){
                    return uriDesciptionEnum;
                }
            }
        }
        return UriDesciptionEnum.INIT_URIDESCIPTION;
    }
}
